home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1995 March / PC Plus Super CD (Issue 101) (March 1995).iso / pcplus / superdsk / visbasic / maxsnap.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-09-08  |  6.8 KB  |  214 lines

  1. VERSION 2.00
  2. Begin Form Full 
  3.    BackColor       =   &H00800000&
  4.    BorderStyle     =   0  'None
  5.    Caption         =   "Form2"
  6.    ClientHeight    =   3510
  7.    ClientLeft      =   2760
  8.    ClientTop       =   2520
  9.    ClientWidth     =   4365
  10.    ClipControls    =   0   'False
  11.    Height          =   3915
  12.    HelpContextID   =   5
  13.    KeyPreview      =   -1  'True
  14.    Left            =   2700
  15.    LinkTopic       =   "Form2"
  16.    MaxButton       =   0   'False
  17.    MinButton       =   0   'False
  18.    ScaleHeight     =   3510
  19.    ScaleWidth      =   4365
  20.    Top             =   2175
  21.    Width           =   4485
  22.    Begin Timer Timer2 
  23.       Interval        =   1000
  24.       Left            =   1860
  25.       Top             =   900
  26.    End
  27.    Begin Timer Timer1 
  28.       Enabled         =   0   'False
  29.       Interval        =   1
  30.       Left            =   960
  31.       Top             =   840
  32.    End
  33.    Begin Label TimeLabel 
  34.       Alignment       =   2  'Center
  35.       BackStyle       =   0  'Transparent
  36.       FontBold        =   -1  'True
  37.       FontItalic      =   -1  'True
  38.       FontName        =   "Arial"
  39.       FontSize        =   48
  40.       FontStrikethru  =   0   'False
  41.       FontUnderline   =   0   'False
  42.       ForeColor       =   &H000000C0&
  43.       Height          =   1095
  44.       Left            =   240
  45.       TabIndex        =   0
  46.       Top             =   1440
  47.       Visible         =   0   'False
  48.       Width           =   4050
  49.    End
  50.    Begin Image Image1 
  51.       Height          =   2115
  52.       Left            =   180
  53.       Top             =   180
  54.       Width           =   2655
  55.    End
  56. Dim Shared slide2 As Integer
  57. Dim Shared zoom As Single
  58. Sub form_click ()
  59. loop1 = 0: Timer1.Enabled = False: slide2 = 0: Unload Full
  60. Main.Timer1.Enabled = True: Main.Timer2.Enabled = True
  61. End Sub
  62. Sub Form_KeyDown (keycode As Integer, shift As Integer)
  63. 'Move the picture according to the key pressed
  64. 'Home,End,Page Dn,Page Up,Arrow Keys,Return
  65. If keycode = 35 Then image1.Left = (Width - image1.Width)
  66. If keycode = 33 Then image1.Top = 0
  67. If keycode = 36 Then image1.Left = 0
  68. If keycode = 34 Then image1.Top = (Height - image1.Height)
  69. If keycode = 39 Then
  70.     If image1.Width + image1.Left <= 50 Then Exit Sub
  71.     image1.Left = image1.Left - (50 * (zoom + 1))
  72. End If
  73. If keycode = 37 Then
  74.     If image1.Left >= Width - 50 Then Exit Sub
  75.     image1.Left = image1.Left + (50 * (zoom + 1))
  76. End If
  77. If keycode = 40 Then
  78.     If image1.Height + image1.Top <= 50 Then Exit Sub
  79.     image1.Top = image1.Top - (50 * (zoom + 1))
  80. End If
  81. If keycode = 38 Then
  82.     If image1.Top >= Height - 50 Then Exit Sub
  83.     image1.Top = image1.Top + (50 * (zoom + 1))
  84. End If
  85. If keycode = 13 Then
  86.     image1.Left = (Width - image1.Width) / 2
  87.     image1.Top = (Height - image1.Height) / 2
  88. End If
  89. End Sub
  90. Sub Form_KeyPress (keyascii As Integer)
  91. If keyascii = 27 Then Call form_click: Exit Sub
  92. End Sub
  93. Sub form_load ()
  94. On Error GoTo Nopicture
  95. zoom = 0: If slide = 1 Then slide2 = 1
  96. image1.Visible = False
  97. 'Maximize form
  98. Left = 0
  99. Top = 0
  100. Width = screen.Width
  101. Height = screen.Height
  102. image1.Width = 1
  103. image1.Height = 1
  104. 'Center TimeLabel
  105. TimeLabel.Left = (Width - TimeLabel.Width) / 2
  106. TimeLabel.Top = (Height - TimeLabel.Height) / 2
  107. 'Exit if selected multiple files
  108. If slide = 1 Then Exit Sub
  109. 'Load the picture in the image control
  110. image1.Picture = LoadPicture(PictureName$)
  111. 'Center picture
  112. image1.Left = (Width - image1.Width) / 2
  113. image1.Top = (Height - image1.Height) / 2
  114. 'If picture bigger than screen...
  115. If image1.Width > Width Then image1.Left = 0
  116. If image1.Height > Height Then image1.Top = 0
  117. image1.Visible = True
  118. Exit Sub
  119. 'Error-Handler if loaded file isn't valid
  120. Nopicture:
  121. Beep: MsgBox Main.File1.List(loop1) + " is" + Chr$(10) + "an " + Error$(Err), 16, "Error": Resume Nopicture2:
  122. Nopicture2:
  123. Call form_click
  124. End Sub
  125. Sub Image1_Click ()
  126. If slide2 = 0 Then Exit Sub
  127. If delay <> 0 Then Timer1.Interval = 1
  128. Call Timer1_Timer
  129. End Sub
  130. Sub Image1_DblClick ()
  131. loop1 = 0: Timer1.Enabled = False: slide2 = 0: Unload Full
  132. Main.Timer1.Enabled = True: Main.Timer2.Enabled = True
  133. End Sub
  134. Sub Image1_MouseDown (Button As Integer, shift As Integer, X As Single, Y As Single)
  135. 'Exit if user selected multiple files
  136. If slide2 <> 0 Then Exit Sub
  137. 'Exit if right mouse button not clicked
  138. If Button <> 2 Then Exit Sub
  139. 'User only clicked right mouse button
  140. 'This increases the size of the image
  141. If shift = 0 Then
  142.     zoom = zoom + 5: If zoom = 25 Then zoom = 0
  143.     image1.Width = 1
  144.     image1.Height = 1
  145.     image1.Visible = False
  146.     image1.Stretch = False
  147.     image1.Width = image1.Width * (1 + zoom / 5)
  148.     image1.Height = image1.Height * (1 + zoom / 5)
  149. End If
  150. 'User clicked right mouse button while holding down [Shift]
  151. 'This decreases the size of the image
  152. If shift = 1 Then
  153.     zoom = zoom - 5: If zoom = -5 Then zoom = 20
  154.     image1.Width = 1
  155.     image1.Height = 1
  156.     image1.Visible = False
  157.     image1.Stretch = False
  158.     image1.Width = image1.Width * (1 + zoom / 5)
  159.     image1.Height = image1.Height * (1 + zoom / 5)
  160. End If
  161. 'User clicked right mouse button while holding down [Ctrl]
  162. 'If time displayed, undisplay and visa versa
  163. If shift = 2 Then
  164.     If TimeLabel.Visible = False Then TimeLabel.Visible = True Else TimeLabel.Visible = False
  165. End If
  166. 'Redisplay image centered
  167. image1.Stretch = True
  168. image1.Left = (Width - image1.Width) / 2
  169. image1.Top = (Height - image1.Height) / 2
  170. image1.Visible = True
  171. End Sub
  172. Sub TimeLabel_MouseDown (Button As Integer, shift As Integer, X As Single, Y As Single)
  173. 'Exit if user selected multiple files
  174. If slide2 <> 0 Then Exit Sub
  175. 'Exit if right mouse button not clicked
  176. If Button <> 2 Then Exit Sub
  177. 'User clicked right mouse button while holding down [Ctrl]
  178. 'If time displayed, undisplay and visa versa
  179. If shift = 2 Then
  180.     If TimeLabel.Visible = False Then TimeLabel.Visible = True Else TimeLabel.Visible = False
  181. End If
  182. End Sub
  183. Sub Timer1_Timer ()
  184. Static loop1 As Integer
  185. On Error GoTo novis
  186. begin:
  187. slide = 0
  188. 'Exit if all pictures have been processed and recycle is off
  189. If loop1 = Main.File1.ListCount Then
  190.     loop1 = 0: If cycle = 0 Then Call form_click: Exit Sub
  191. End If
  192. 'If picture is selected then ...
  193. If Main.File1.Selected(loop1) = True Then
  194.     PictureName$ = Main.Dir1.Path
  195.     If Right$(PictureName$, 1) <> "\" Then PictureName$ = PictureName$ + "\"
  196.     PictureName$ = PictureName$ + Main.File1.List(loop1)
  197.     Call form_load
  198.     Timer1.Interval = delay * 1000
  199.     loop1 = loop1 + 1
  200.     Exit Sub
  201. End If
  202. '... if not, continue loop with smallest delay
  203. loop1 = loop1 + 1: Timer1.Interval = 1
  204. 'Error-Handler
  205. novis:
  206. Resume novis2:
  207. novis2:
  208. Exit Sub
  209. End Sub
  210. Sub Timer2_Timer ()
  211. 'Display the time
  212. TimeLabel.Caption = Left$(Time$, 8)
  213. End Sub
  214.